<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<c:set var="extLibs" value="validate,fileupload"/>
<sys:header title="帮扶金申报- ${member.isNewRecord ? '新增' : '编辑'}帮扶金申报" extLibs="${extLibs}" htmlClass="scroll"/>
<link href="${ctxStatic}/common/css/form.css" rel="stylesheet" type="text/css">
<div class="portlet box ${boxStyleColor} autoHeight">
	<div class="portlet-body form">
		<form:form id="inputForm" modelAttribute="helpIllness" action="${ctx}/ums/helpIllness/save" method="post" class="form-horizontal">
				<div class="tool">
					<c:if test="${helpIllness.isNewRecord}">
						<input id="btnSubmit" type="button" value="提交" class="tool1">
					</c:if>
					<input id="btnCancel" type="button" value="关闭" class="tool1" onclick="closeCurrentTabPage('${param.parentTabPageId}')">
				</div>
				<div class="biaodan_bg">
					<div class="biaodan">
						<table width="100%" border="0" class="tb2">
						    <tr>
						          <td colspan="7" align="center"  ><strong style="font-size:24px; font-weight:normal;">${fns:getConfig('university')}癌症等重大疾病患者申报表</strong></td>
						    </tr>
						</table>
							<table width="100%" border="0" class="tb4">
							<tr>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">姓名</td>
								<td width="120">
									<form:hidden path="billType" value="DB"/>
									<form:hidden path="memberCode"/>
									<form:input path="memberName" htmlEscape="false" maxlength="64" class="form-control required"/>
								</td>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">分工会</td>
								<td width="120">
									<sys:treeselect id="office" name="officeCode" value="${helpIllness.officeCode}" labelName="officeName" labelValue="${helpIllness.officeName}"
							 			title="单位" url="/sys/office/treeData?isAll=true" cssClass="required"  allowClear="true"/>
								</td>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">性别</td>
								<td width="120">
									<form:select path="sex" multiple="false" class="form-control required input-sm"  >
										<form:options items="${fns:getDictList('sex')}" itemLabel="name" itemValue="value" htmlEscape="false"/>
									</form:select>
								</td>
							</tr>
							<tr>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">工资编号</td>
								<td>
									<form:input path="workNo" htmlEscape="false" maxlength="64" class="form-control required"/>
								</td>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">出生年月</td>
								<td>
									<input name="birthday" type="text" readonly="readonly" maxlength="20" class="form-control Wdate required"
											value="<fmt:formatDate value="${helpIllness.birthday}" pattern="yyyy-MM-dd"/>"
											onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
								</td>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">联系电话：</td>
								<td>
									<form:input path="phone" htmlEscape="false" maxlength="64" class="form-control required"/>
								</td>
							</tr>
							<tr>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">患病时间</td>
								<td>
									<input name="illTime" type="text" readonly="readonly" maxlength="20" class="form-control Wdate required"
											value="<fmt:formatDate value="${helpIllness.illTime}" pattern="yyyy-MM-dd"/>"
											onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
								</td>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">患病名称</td>
								<td>
									<form:select path="illName" multiple="false" class="form-control required input-sm"  >
										<form:option value="">请选择</form:option>
										<form:options items="${fns:getDictList('ill_type')}" itemLabel="name" itemValue="name" htmlEscape="false"/>
									</form:select>
								</td>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">病情程度</td>
								<td>
									<form:select path="illDegree" multiple="false" class="form-control required input-sm"  >
										<form:option value="">请选择</form:option>
										<form:options items="${fns:getDictList('ill_degree')}" itemLabel="name" itemValue="name" htmlEscape="false"/>
									</form:select>
								</td>
							</tr>
							<tr>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">家庭住址</td>
								<td colspan="5">
									<form:input path="address" htmlEscape="false" maxlength="64" class="form-control required"/>
								</td>
								
							</tr>
							<tr>
								<td  width="100" class="text-center" bgcolor="#f5f5f5">备注</td>
								<td colspan="5">
									<form:textarea path="reason" htmlEscape="false" rows="8" maxlength="200" class="form-control required input-sm"/>
								</td>
							</tr>
						</table>
						<label class="red"> 1.重大疾病特指：恶性肿瘤、慢性肾功能衰竭（血液透析）、器官移植术后排异反应治疗</label>
						<label class="red">2.在患病名称里注明病情程度，如Ⅱ型、晚期。</label>
						 <div class="hide">
							<input type="hidden" id="flowId" name="flowId"/>
							<sys:listselect id="approval" name="approvalCode" value="" labelName="approvalName" labelValue=""
								boxHeight="500"	boxWidth="450" returnCodeAttr="userCode" returnNameAttr="userName"	title="审批人" url="" multiple="true" cssClass="form-control"  />
						</div>
					</div>
			</div>
		</form:form>
	</div>
</div>
<sys:footer extLibs="${extLibs}"/>
<script type="text/javascript">
	$("#inputForm").validate({
		submitHandler: function(form){
			ajaxSubmitForm($(form), function(data){
				showMessage(data.message);
				if(data.result == Global.TRUE){
					closeCurrentTabPage('${param.parentTabPageId}', function(contents, contentWindow){
						contentWindow.page();
					});
				}
			}, "json");
	    }
	});
	
	$('#btnSubmit').click(function(){
		$.post("${ctx}/eflow/flowTemplate/getFirstStep",
			{"billType":$("#billType").val(),
			 "companyCode":$("#officeCode").val(), 
			 "officeCode":$("#officeCode").val(),
			 "applicantCode":$("#memberCode").val(),
			 "billAmt":$("#billAmt").val()},
			function(data){
				if(data.result  == Global.FALSE){
					showMessage(data.message);
				}else{
					$("#flowId").val(data.firstStep.flowId);
					// 指定到人，弹出审批人选择界面
					if(data.firstStep.isFixApproval){
						var url = "${ctx}/eflow/flowBusiness/approvalSelect?flowTemplatesId="+data.firstStep.id;
						$("#approvalDiv").attr("data-url",url);
						$("#approvalName").click();
					} else if(data.firstStep.approvalType == "1"){
						// 不指定人，直接提交
						$("#inputForm").submit();
					}
					
				}
			},"json"
		)
	});
		

	function approvalCallbackForMap(dataMap, v, h, f){
		$.each(dataMap, function(key, value){
			$("#approvalCode").val(value.userCode);
		})
		$("#inputForm").submit();
	}
</script>